package testing;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class LineCounter {
	public static void main(String[] args){
		String filesJamison[] = {
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\ArticleAggregator.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\ArticleTrainer.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\DateScorer.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\FuzzyStringEqualizer.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\IScorer.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\KeywordFilter.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\QuotationsScorer.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\analysis\\QuotationsTrainer.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\Article.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\ArticleID.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\FakeDatabase.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\Story.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\StoryID.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\FileLogger.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\IDatabase.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\ILogger.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\IPreferences.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\Manager.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\TestingPreferences.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\XMLPreferences.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\manager\\preferences.xml",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\BBCParser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\CategoryChooser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\CNNParser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\DateConverter.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\DateException.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\IPageParser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\NYTimesParser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\RSSMonitor.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\SourceParser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\parsing\\TheGuardianParser.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\ArticleTest.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\BBCParserTest.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\DateScorerTest.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\FuzzyStringEqualizerTest.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\KeywordScorerTest.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\SourceTest.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\testing\\TestMain.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\utility\\Pair.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\utility\\Source.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\utility\\Util.java",
								};
		String filesCharles[] = {
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\FirstCon.java",
								"C:\\Users\\Jamison\\workspace\\Prototyping\\src\\database\\SQLDatabase.java",
								};
		
		int linesJamison = 0;
		int linesCharles = 0;
		
		for (String file: filesJamison){
			try{
				BufferedReader reader = new BufferedReader(new FileReader(new File(file)));
				String line = reader.readLine();
				while (line != null){
					line = reader.readLine();
					linesJamison++;
				}
				reader.close();
			}
			catch (IOException e){
				e.printStackTrace();
			}
		}
		
		for (String file: filesCharles){
			try{
				BufferedReader reader = new BufferedReader(new FileReader(new File(file)));
				String line = reader.readLine();
				while (line != null){
					line = reader.readLine();
					linesCharles++;
				}
				reader.close();
			}
			catch (IOException e){
				e.printStackTrace();
			}
		}
		
		double totalLines = linesCharles + linesJamison;
		double percentJamison = ( ((double) linesJamison) / totalLines) * 100;
		double percentCharles = ( ((double) linesCharles) / totalLines) * 100;
		
		System.out.println("Lines of Code in Project Jamison = " + linesJamison + " (" + percentJamison + "%)");
		System.out.println("Lines of Code in Project Charles = " + linesCharles + " (" + percentCharles + "%)");
	}
}
